package cn.tradewin.pmp.pages.activiti;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

public class VacationFlow {

	@Inject
    private RuntimeService runtimeService;
	
	@Property
	private int days;
	
	@Property
	private Date firstDate;
	
	@Property
	private String motivation;
	
	
	Object onSubmit() {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("days", days);
		param.put("firstDate", firstDate);
		param.put("motivation", motivation);
		ProcessInstance instance = runtimeService.startProcessInstanceByKey("myProcess", param);
		return TaskList.class;
	}
}
